package net.wanho.customerManage.dao.impl;

import net.wanho.commons.exception.DaoException;
import net.wanho.commons.exception.DataAccessException;
import net.wanho.commons.factory.BeanFactory;
import net.wanho.commons.util.JDBCTemplate;
import net.wanho.customerManage.dao.BusinessSourceDao;
import net.wanho.customerManage.po.BusinessSource;
import net.wanho.customerManage.po.LinkMan;

import java.util.List;

public class BusinessSourceDaoImpl implements BusinessSourceDao {
    private JDBCTemplate jdbcTemplate = BeanFactory.getBean(JDBCTemplate.class) ;
    @Override
    public List<BusinessSource> selectAllBusinessSource() throws DaoException {
        final String SELECT_ALL_BUSINESS_SOURCE_SQL = "SELECT \tSOURCE_ID SOURCEID, \n" +
                "\tSOURCE_NAME  SOURCENAME\n" +
                "\tFROM\n" +
                "\tbusiness_source " ;
        try {
            return jdbcTemplate.queryForList(SELECT_ALL_BUSINESS_SOURCE_SQL, BusinessSource.class);
        } catch (DataAccessException e) {
            e.printStackTrace();
            throw new DaoException(e.getMessage()) ;
        }
    }
}
